﻿@using PagedList
@using PagedList.Mvc
@model IEnumerable<CMS.Models.Article>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>
<div>
    @using (Html.BeginForm("Index", "Articles", new { area = "Admin" },
FormMethod.Get, new { @class = "navbar-form navbar-left", role = "search" }))
    {
        <div class="form-group">
            <input type="text" class="form-control" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">搜尋</button>
    }

</div>
<p>
    @Html.ActionLink("Create New", "Create")
</p>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Subject)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Summary)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ContentText)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IsPublich)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PublishDate)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ViewCount)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CreateUser)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CreateDate)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.UpdateUser)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.UpdateDate)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Subject)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Summary)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ContentText)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.IsPublich)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PublishDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ViewCount)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CreateUser)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CreateDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UpdateUser)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UpdateDate)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
                @Html.ActionLink("Details", "Details", new { id = item.ID }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.ID })
            </td>
        </tr>
    }

</table>
@Html.PagedListPager((IPagedList)Model, x => Url.Action("Index", new { page = x }))